﻿using MathNet.Numerics.Interpolation;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MESMian.EntityMapping
{
    public class ProductCategoriesMapping : IEntityTypeConfiguration<ProductCategories>
    {
        public void Configure(EntityTypeBuilder<ProductCategories> builder)
        {
            builder.ToTable("ProductCategories");
            builder.HasKey(pc => pc.ProductCategoryId);

            builder.Property(pc => pc.ProductCategoryName)
                .IsRequired()
                .HasColumnType("varchar(30)");

            builder.Property(pc=>pc.Status)
                .IsRequired()
                .HasColumnType("int")
                .HasDefaultValue(0);

            builder.Property(pc => pc.CreateUserId)
                .IsRequired()
                .HasColumnType("int");

            builder.Property(pc => pc.CreateTime)
                .IsRequired()
                .HasDefaultValueSql("GETDATE()")
                .HasColumnType("datetime");

            builder.Property(pc => pc.LastUpdateUserId)
                .HasColumnType("int");

            builder.Property(pc => pc.LastUpdateTime)
                .HasColumnType("datetime");
        }
    }
}
